package pl.edu.mimuw.irs.core.model.simulation.exception;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-07
 */
public class InternalSimulationException extends RuntimeException {

	// *** Attributes

	// Required id
	private static final long serialVersionUID = -971661464060465302L;
	// Cause of this exception
	private SimulationCause cause;
	private Object[] opts;
	
	// *** Methods
	

	public InternalSimulationException(SimulationCause cause, Object... opts) {
		this.cause = cause;
		this.opts = opts;
	}
	
	@Override
	public String toString() {
		StringBuffer stringBuffer = new StringBuffer();
		stringBuffer.append("InternalException." + cause.toString());
		if (opts != null && opts.length > 0) {
			stringBuffer.append("[");
			for (Object opt : opts) {
				stringBuffer.append(opt);
				stringBuffer.append(",");
			}
			stringBuffer.replace(stringBuffer.lastIndexOf(","), 
					stringBuffer.length(), "]");
		}
		
		return stringBuffer.toString();
	}

	// *** Enums

	public enum SimulationCause {
		NO_APPLICABLE_RUNS_FOUND;
	}
}
